//
//  DengLu.m
//  10-10
//
//  Created by 钟纪旺 on 16/10/18.
//  Copyright © 2016年 zjw. All rights reserved.
//

#import "DengLu.h"
#import "FirstViewController.h"
#import "LoginData.h"
#import "Network.h"
@interface DengLu ()@property (strong, nonatomic) IBOutlet UITextField *userName;
@property (strong, nonatomic) IBOutlet UITextField *password;


@end

@implementation DengLu



- (IBAction)onClick:(id)sender
{
        [Network loginWithName:self.userName.text password:self.password.text  complete:^(LoginData *d)
    {
        
      
        LoginData *ata = d;
        
        
                UITabBarController *con = [self.storyboard instantiateViewControllerWithIdentifier:@"liudehua"];
                
                //推进去
                [self presentViewController:con animated:YES completion:^{
                    
                }];
                
        
        
    }];
}

- (IBAction)onCarce:(id)sender {
    [self dismissViewControllerAnimated:YES completion:nil];
    
    

}
- (void)viewDidLoad {
    [super viewDidLoad];
    self.password.secureTextEntry = YES;
    self.password.clearButtonMode = UITextFieldViewModeWhileEditing;
    self.userName.clearButtonMode = UITextFieldViewModeWhileEditing;
    UIToolbar *tobView = [[UIToolbar alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width,44)];
    [tobView setBarStyle:UIBarStyleBlack];
    UIBarButtonItem *button1 = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
    UIBarButtonItem *button2 =[[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:nil action:nil];
    UIBarButtonItem* doneButton = [[UIBarButtonItem alloc]initWithTitle:@"完成"style:UIBarButtonItemStyleDone target:self action:@selector(endEdit)];
    NSArray* buttonsArray = [NSArray arrayWithObjects:button1,button2,doneButton,nil];
    [tobView setItems:buttonsArray];
    [self.userName setInputAccessoryView:tobView];
    [self.password setInputAccessoryView:tobView];
    
}
-(void) endEdit
{
    [self.view endEditing:YES];
}

- (void) touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{

    [self.view endEditing:YES];
}

////下导航消失
//-(void)viewWillAppear:(BOOL)animated
//{
//    [super viewWillAppear:animated];
//    self.navigationController.tabBarController.tabBar.hidden = YES;
//}
//
////下导航出现
//- (void)viewWillDisappear:(BOOL)animated {
//    
//    [super viewWillDisappear:animated];
//    [super viewWillAppear:animated];
////    self.navigationController.tabBarController.tabBar.hidden = NO;
//}
//- (void)didReceiveMemoryWarning {
//    [super didReceiveMemoryWarning];
//    // Dispose of any resources that can be recreated.
//}
//

@end
